home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / electronic / rlab / TestMatrix / eigsens_r < prev    next >
Encoding:
Text File  |  1994-12-20  |  1.2 KB  |  45 lines

  1. //-------------------------------------------------------------------//
  2.  
  3. // Synopsis:    Eigenvalue condition numbers.
  4.  
  5. // Syntax:    eigsens ( A )
  6.  
  7. // Description:
  8.  
  9. //    Returns a vector of condition numbers for the eigenvalues of A
  10. //    (reciprocals of the Wilkinson s(lambda) numbers). These
  11. //    condition numbers are the reciprocals of the cosines of the
  12. //    angles between the left and right eigenvectors. 
  13.  
  14. //    Eigsens returns a list containing elements:
  15. //          vec    eigenvectors
  16. //        val    eigenvalues
  17. //        sens    sensitivities
  18.  
  19. //          Reference:
  20. //          G.H. Golub and C.F. Van Loan, Matrix Computations, Second
  21. //          Edition, Johns Hopkins University Press, Baltimore, Maryland,
  22. //          1989, sec. 7.2.2.
  23.  
  24. //    This file is a translation of eigsens.m from version 2.0 of
  25. //    "The Test Matrix Toolbox for Matlab", described in Numerical
  26. //    Analysis Report No. 237, December 1993, by N. J. Higham.
  27.  
  28. //-------------------------------------------------------------------//
  29.  
  30. eigsens = function ( A )
  31. {
  32.   n = max(size(A));
  33.   s = zeros(n,1);
  34.  
  35.   e = eig (A);
  36.   Y = inv(e.vec);
  37.  
  38.   for (i in 1:n)
  39.   {
  40.     s[i] = norm(Y[i;],"2") * norm(e.vec[i;],"2") / abs( Y[i;]*e.vec[;i] );
  41.   }
  42.  
  43.   return << vec = e.vec; val = e.val; sens = s >>;
  44. };
  45.